import numpy as np
import matplotlib.pyplot as plt

x = np.linspace(-1, 1, 20)
y = np.linspace(-1, 1, 20)
# 将x,y 坐标值的交织，成为一张覆盖x,y坐标系的网格
x, y = np.meshgrid(x, y, indexing='ij')

z = x ** 2 + y ** 2

ax = plt.subplot(111, projection='3d')
ax.plot_surface(x, y, z, cmap=plt.cm.YlGnBu_r)

plt.show()
